<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="jquery-1.11.3.min.js"></script>
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .container {
            width: 675px;
            height: 355px;
            margin: 50px auto;
            overflow: hidden;
            position: relative;
        }

        ul,
        ol {
            list-style: none;
        }

        ul li {
            width: 675px;
            height: 355px;

        }

        .left {
            width: 30px;
            height: 60px;
            line-height: 60px;
            text-align: center;
            background-color: #ccc;
            font-size: 20px;
            position: absolute;
            top: 148px;
            left: 0;
            opacity: 0.6;
            display: none;
        }

        .right {
            width: 30px;
            height: 60px;
            line-height: 60px;
            text-align: center;
            background-color: #ccc;
            font-size: 20px;
            position: absolute;
            top: 148px;
            right: 0;
            opacity: 0.6;
            display: none;
        }

        ol {
            position: absolute;
            bottom: 20px;
            left: 250px;

        }

        ol li {
            float: left;
            width: 20px;
            height: 20px;
            border-radius: 100%;
            background-color: #fff;
            margin-left: 15px;
        }

        .active {
            background-color: #ff0000;
        }
    </style>
</head>

<body>
    <div class="container" id="container">
        <ul id="lis">
            <li><img src="img/choose1.jpg"></li>
            <li><img src="img/choose2.jpg"></li>
            <li><img src="img/choose3.jpg"></li>
            <li><img src="img/choose4.jpg"></li>
            <li><img src="img/choose5.jpg"></li>

        </ul>
        <div class="left" id="left">
            </div> <div class="right" id="right">>
        </div>
        <ol id="ols">
            <li class="active"></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ol>
    </div>
    <script>
        //鼠标移入container  显示左右箭头.注意：通过getElementByClassName 添加onmouseover无反应
        var container = document.getElementById("container");
        var left = document.getElementById("left");
        var right = document.getElementById("right");
        var lis = document.getElementById("lis");
        var uli = lis.getElementsByTagName("li");
        var index = 0;
        var ols = document.getElementById("ols");
        var oli = ols.getElementsByTagName("li");
        container.onmouseover = function () {

            left.style.display = "block";
            right.style.display = "block";

        }
        container.onmouseout = function () {

            left.style.display = "none";
            right.style.display = "none";

        }
        // 点击右侧箭头，切换下一张
        right.onclick = function () {
            for (var i = 0; i < uli.length; i++) {
                uli[i].style.display = "none";
                oli[i].className = "";
            }
            index++;
            if (index > uli.length - 1) {
                index = 0;
            }
            uli[index].style.display = "block";
            oli[index].className = "active"
        }
        // 点击左侧箭头，切换上一张
        left.onclick = function () {

            for (var i = 0; i < uli.length; i++) {
                uli[i].style.display = "none";
                oli[i].className = "";
            }
            index--;
            if (index < 0) {
                index = uli.length - 1;
            }

            uli[index].style.display = "block";
            oli[index].className = "active"
        }

        //网站变灰色，在指定时间内
        var now = new Date().getTime();
        var over = new Date('2020/04/07 11:50:00').getTime();
        if (now < over) {
            $("html").css({
                'webkit-filter': 'grayscale(100%)',
                '-moz-filter': 'grayscale(100%)',
                '-ms-filter': 'grayscale(100%)',
                '-o-filter': 'grayscale(100%)',
                // ie滤镜
                'filter': 'progid:DXImageTransform.Microsoft.Basiclmage(grayscale=1)',
                // ie6等低版本浏览器不需要加滤镜
                '_filter': 'none'
            });

      
        }
    </script>
</body>

</html>